This function enables a symbol pattern to be modified to fit into a given range of semitone values - where zero (0) is middle C or C 5 (ex. -5 12) - or a preset instrumental range (ex. violin), or a symbol range (ex. -f m)
In the examples below there are instances of two types of range processing on symbols that exceed the given range. These are :transpose and :invert.
(setq sym1 '(a b c d e f g h i j k l m n))
(setq sym2 '(a a b g m b -k -q -k e = = s s y w y w ] ] \c \p))
(setq sym3 '((a b cd e f gh i j k lm n)
(a a bg m b -k-q -k e s sy w yw ] ] \c\p)))
(setq sym4 '((a b cd = gh i j k = lm n) nil
(a a bg m = = -k-q -k e s sy w yw \c\p) nil))
(ambitus :transpose -5 12 sym1)
=> (a b c d e f g h i j k l m b)
(ambitus :transpose 'g3 'c5 sym1)
=> (a b c d e f g h i j k l m b)
(ambitus :transpose '-f 'm sym1)
=> (a b c d e f g h i j k l m b)
(ambitus :invert -5 12 sym1)
=> (a b c d e f g h i j k l m l)
In the first example using the type parameter :transpose the symbol n is transposed down an octave to b. In the second example the symbol n is inverted according to its pitch class value to become l.
The remaining examples demonstrate how the function is able to operate on any instrument held in the instrument-range library, operate on multiple lists handle chords, and mor complex symbol pattern groupings.
(ambitus :transpose 'violin sym2)
=> (a a b g m b c -e c e = = s s y w y w ] ] \c \d)
(ambitus :invert 'violin sym2)
=> (a a b g m b m g m [ = = \i \i \c \a \c \a \g \g \a t)
(ambitus :transpose 'viola sym3)
=> ((a b cd e f gh i j k lm n) (a a bg m b -k-e -k e s sy w yw ] ] wx))
(ambitus :invert 'viola sym3)
=> ((a b cd e f gh i j k lm n) (a a bg m b -k-e c q _ _y w yw ] ] wj))